package com.shenmazong.servereduresume.controller;

import com.baomidou.mybatisplus.extension.service.IService;
import com.shenmazong.servereduresume.dto.TbInformation;
import com.shenmazong.servereduresume.service.TbInformationService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.BatchChooseIdVo;
import com.shenmazong.vo.ListParamVo;
import fr.opensagres.xdocreport.core.XDocReportException;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 *简历信息表
 */
@RestController
@RequestMapping("information")
//@CrossOrigin
public class TbInformationController  {

    @Autowired
    private TbInformationService tbInformationService;

    @PostMapping("findByUserIdInformationId")
    public ResultResponse findByUserIdInformationId(@RequestBody BatchChooseIdVo batchChooseIdVo){
        return tbInformationService.findByUserIdInformationId(batchChooseIdVo);
    }

    @PostMapping("listPageInformation")
    public ResultResponse listPageInformation(@RequestBody ListParamVo listParamVo){
        return tbInformationService.listPageInformation(listParamVo);
    }


    @PostMapping("saveInformation")
    public ResultResponse saveInformation(@RequestBody TbInformation tbInformation){
        return tbInformationService.saveInformation(tbInformation);
    }

    @PostMapping("updateInformation")
    public ResultResponse updateInformation(@RequestBody TbInformation tbInformation){
        return tbInformationService.updateInformation(tbInformation);
    }

    @PostMapping("deleteInformation")
    public ResultResponse deleteInformation(@RequestBody BatchChooseIdVo batchChooseIdVo){
        return tbInformationService.deleteInformation(batchChooseIdVo);
    }

    @PostMapping("downloadResume/{id}")
    public ResultResponse downloadResume(@PathVariable("id")Long id) throws IOException, XDocReportException {
        return tbInformationService.downloadResume(id);
    }
}
